<template>
      <div class="panel panel-info auto">
         <div class="panel-heading">
          <h4 style="display:inline-block;">汇总信息分析</h4>
        </div>
        <div class="auto info-content">
            <div class="row" v-for='temp in viewData'>
              <label class = "col-sm-5 control-label">{{temp.key}}</label>
              <span class = "col-sm-7">{{temp.value}}</span>
            </div>
        </div>
      </div>
</template>
<script>
export default {
  title: '综合查询',
  data () {
    return {
      viewData: []
    }
  },
  props: ['data'],
  ready () {
    // console.log('获取合计信息', this.data)
    this.packingToData()
  },
  watch: {
    'data.state' (val) {
      this.packingToData()
    }
  },
  methods: {
    packingToData () {
      this.viewData = []
      let i = 0
      if (this.data.sums) {
        Object.keys(this.data.sums).forEach((item) => {
          let view_value = {}
          view_value.key = item.split('_')[1] + '合计'
          view_value.value = Object.values(this.data.sums)[i]
          i = i + 1
          this.viewData.push(view_value)
        })
      }
    }
  }
}
</script>
<style lang="less">
  .control-label {
    height: 23px;
    border-right: 1px solid #F2F6FA;
    margin-bottom: 0;
    text-align: left;
  }
  .info-content {
    padding:6px;
    span {
      padding-left: 5px;
    }
  }
</style>
